package com.example.springcloudfeign.feign;

import com.example.springcloudfeign.pojo.StudentPo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "ribbon-project",fallback = ServerFeignFallBack.class)
public interface ServerFeign {
    /**
     * 方法要求
     * 返回值要对应
     * 方法名随意
     * 参数随意
     */
    @RequestMapping("/ribbon")
    String service();


    /**
     * 在OpenFeign中,方法参数前如果没有注解,默认添加@RequestBody,最多只能存在一个不带注解的参数
     * 如果是普通表单参数,必须添加@Requstparam注解,如果参数名和变量名对应,可以不写name
     *
     * @return
     */
    @RequestMapping("/ribbonDemo2")
    String feginRequestBody(@RequestParam String name, @RequestParam String age);

    @RequestMapping("/ribbonDemo3/{name}/{age}")
    String feignWithRestful(@PathVariable String name, @PathVariable Integer age);

    @RequestMapping("/returnRequestBody")
    StudentPo feignWithRequestBody(StudentPo studentPo);

    @RequestMapping("/retrunNormalFormDataDemo6")
    StudentPo feignWithNormalFormDataDemo6(@RequestParam StudentPo studentPo);




}
